package com.quarkus.client;

import com.quarkus.RestClientHeaderFactory;
import com.quarkus.bean.Country;
import com.quarkus.bean.MultipartBody;
import io.smallrye.mutiny.Uni;
import org.eclipse.microprofile.rest.client.annotation.RegisterClientHeaders;
import org.eclipse.microprofile.rest.client.inject.RegisterRestClient;
import org.jboss.resteasy.annotations.providers.multipart.MultipartForm;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import java.util.concurrent.CompletionStage;

@Path("v2")
@RegisterRestClient(configKey = "country-api")
//@RegisterClientHeaders(RestClientHeaderFactory.class)
public interface CountriesService {

    @GET
    @Path("/name/{name}")
    Country getByName(@PathParam("name") String name);

//    @GET
//    @Path("/name/{name}")
//    CompletionStage<Country> getByName2(@PathParam("name") String name);

//    @GET
//    @Path("/name/{name}")
//    @Produces("application/json")
//    Uni<Country> getByName3(@PathParam("name") String name);

    @Path("/name/echo")
    @POST
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    @Produces(MediaType.TEXT_PLAIN)
    String sendMultipartData(@MultipartForm MultipartBody data);
}
